package org.example.deep.dao;

import org.example.deep.entity.ElecDeepFile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author jianxin.wei
 * @description
 * @date 2024/9/11 15:15
 */
@Repository
public interface ElecDeepFileRepository extends JpaRepository<ElecDeepFile,Long> {
    @Query(nativeQuery = true, value = "select * from ELEC_DEEP_FILE where FILE_TYPE=?1")
    ElecDeepFile findTemplate(int i);

    @Query(nativeQuery = true, value = "select SEQ_ELEC_DEEP_FILE.NEXTVAL FROM DUAL")
    long findSeq();

    @Query(nativeQuery = true, value = "select * from ELEC_DEEP_FILE where FILE_NAME=?1 AND FILE_TYPE=?2")
    ElecDeepFile findByFileName(String fileName, Integer fileType);

    @Query(nativeQuery = true, value = "select * from ELEC_DEEP_FILE where FILE_TYPE=?1 ORDER BY FILE_NAME DESC")
    List<ElecDeepFile> findAllFile(Integer fileType);
}
